package cn.xiazhi.charging.user.controller;

import cn.xiazhi.charging.common.JsonResult;
import cn.xiazhi.charging.pojo.vo.UserInfoVO;
import cn.xiazhi.charging.user.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Slf4j
@RestController
@RequestMapping("/user")
@Api(tags = "用户管理")
public class UserController {
    @Autowired
    private UserService userService;

    @GetMapping("info/{userId}")
    @ApiOperation("获取用户信息")
    @ApiImplicitParam(name = "userId", value = "用户id", required = true)
    public JsonResult<UserInfoVO> getUserCarInfo(@PathVariable Integer userId){
        log.debug("获取用户信息，userId:{}", userId);
        UserInfoVO userInfoVO = userService.info(userId);
        return JsonResult.ok(userInfoVO);
    }
}
